#ifndef FILE_H
#define FILE_H

#include <QWidget>
#include "protocol.h"
#include <QListWidgetItem>
#include <QFile>
#include "sharefile.h"

namespace Ui {
class File;
}

class File : public QWidget
{
    Q_OBJECT

public:
    explicit File(QWidget *parent = nullptr);
    ~File();
    QString m_strCurPath;
    QString m_strUserPath;
    //移动文件相关属性
    QString m_strMoveFileName;
    QString m_strMovePath;
    //上传文件相关属性
    bool m_bUpload;
    QString m_strUploadFilePath;
    //下载文件相关属性
    bool m_bDownload;
    qint64 m_iDownloadTotal;
    qint64 m_iDownloadReceived;
    QString m_strSavePath;
    QString m_strDownloadFileName;
    QFile m_fDownloadFile;
    //分享文件
    QString m_strShareFileName;

    void flushFile();
    void showFileList(QList<FileInfo*> pFileInfoList);
    QList<FileInfo*> m_pFileInfoList;
    void uploadFile();
    void downloadFile(qint64 iFileSize);
    void downloadFileData(char* buffer, int size);
    ShareFile* m_pShareFile;//变成共有的

private slots:
    void on_mkDir_PB_clicked();

    void on_flushFile_PB_clicked();

    void on_delDir_PB_clicked();

    void on_rename_PB_clicked();

    void on_delFile_PB_clicked();

    void on_file_LW_itemDoubleClicked(QListWidgetItem *item);

    void on_retrun_PB_clicked();

    void on_mvFile_PB_clicked();

    void on_upload_PB_clicked();

    void on_download_PB_clicked();

    void on_shareFile_PB_clicked();

private:
    Ui::File *ui;

};

#endif // FILE_H
